#ifndef LHC_FILESYSTEM_H_INCLUDED_
#define LHC_FILESYSTEM_H_INCLUDED_

#include "UnicodeString.h"
#include <vector>

namespace lhcutils
{

struct SymlinkBehavior
{
	enum Value
	{
		FollowLinks,
		DontFollowLinks
	};
};

struct FileSysEntityType
{
	enum Value
	{
		File,
		Directory,
		Symlink
	};
};

StringPtr ToString(FileSysEntityType::Value fileSysEntityType)
{
	switch(fileSysEntityType)
	{
	case FileSysEntityType::File:
		return ustr("file");
		break;
	case FileSysEntityType::Directory:
		return ustr("directory");
		break;
	case FileSysEntityType::Symlink:
		return ustr("symbolic link");
		break;
	default:
		return ustr("unknown");
	}
}
	
// Checks if a file system entity with the given path exists. If the path refers to a symbolic link,
// the function applies to the target of the link, not the link itself.
// Throws IoException, FileNotFoundException on error.
FileSysEntityType::Value GetFileSysEntityType(const UnicodeString& filePath, SymlinkBehavior::Value symlinkBehavior = SymlinkBehavior::FollowLinks);

// Throws FileNotFoundException, IoException on error
// Returns full paths, not file names.
std::vector<StringPtr> GetEntitiesInDirectory(const UnicodeString& dirPath);

}

#endif

/*
 Copyright 2011 Greg Najda

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
